import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue'; // 直接使用静态导入

export default defineConfig({
    resolve: {
        alias: {
          'vue': 'vue/dist/vue.esm-bundler.js', // 添加这行
          'ant-design-vue/dist': 'ant-design-vue/dist'
        }
      },
  plugins: [
    laravel({
      input: ['resources/css/app.css', 'resources/js/app.js'],
      refresh: true,
    }),
    vue({ // 直接使用导入的 vue
      template: {
        transformAssetUrls: {
          base: null,
          includeAbsolute: false,
        },
      },
    }),
  ],
    css: {
        preprocessorOptions: {
        less: {
            javascriptEnabled: true,
        },
        },
    },
  server: {
    proxy: {
      '/api': {
        target: 'http://localhost:8000',
        changeOrigin: true
      }
    }
  },
  optimizeDeps: {
    include: ['@vitejs/plugin-vue']
  }
});